package com.keyinong.jiashiyuan.view;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.keyinong.jiashiyuan.R;
import com.keyinong.jiashiyuan.tools.Tools;

public class ShangjiaFramgment extends Fragment{
	View view;
	WebView webView;
	
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		try {
			view=View.inflate(getActivity(), R.layout.fragment_shangjia, null);
			
			setupView();
			addListener();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return view;
	}
	private void addListener() {
		// TODO Auto-generated method stub
		
	}
	private void setupView() {
		webView = (WebView) view.findViewById(R.id.webView1);  
		
	}
	@SuppressLint("SetJavaScriptEnabled")
	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onViewCreated(view, savedInstanceState);
		webView=(WebView) view.findViewById(R.id.webView1);
		webView.getSettings().setJavaScriptEnabled(true);
		String token;
		SharedPreferences sp=getActivity().getSharedPreferences("spReg", Context.MODE_PRIVATE);
		token=sp.getString("token", "");
		webView.loadUrl(Tools.shangjiaUrl+token);
	}

}
